import {
    ref,
    computed,
    toRefs,
    getCurrentInstance,
    reactive,
    onBeforeMount,
    onMounted
} from 'vue'
export default function () {
    const {
        appContext
    } = getCurrentInstance();
    const api = appContext.config.globalProperties.api;
    const params = reactive({
        data: {
            id: 1,
            name: "sivan",
            age: "99"
        },
        briefParams: {
            province_code: '530000',
            visa_country_id: '10003'
        },
        productParams: {
            visa_product_id: '14520'
        }
    });
    const returnState = reactive({
        brief: {},
        product: {},
        list: []
    })
    const sendPost = async () => {
        let res = await api.post('/test_post', params.data);
        returnState.list = res;
    };
    const getBriefList = async () => {
        let {
            body
        } = await api.post('/sys/visa_product_brief_query', params.productParams);
        returnState.brief = body;
    }
    const getProductList = async () => {
        let {
            body
        } = await api.post('/sys/visa_product_query', params.briefParams);
        returnState.product = body;
        console.log(returnState.product);
        console.log('---------请求----------')
        console.log(returnState.product.handle_process);

    }
    onBeforeMount(() => {})
    onMounted(() => {
        sendPost();
        getBriefList();
        getProductList();
    })
    return {
        ...toRefs(returnState)
    }
}